layui.define(['jquery','form', 'element', 'YsModal'], function (exports) {
	"use strict";
	var $ = layui.jquery,form=layui.form,object = {
		c: {data:[]}, // 配置项
		f: function (c) { // 数据初始化
			var s=new Date().getTime(),t = this;
			t.c.id = c.id?c.id:'simple_table_TCC_LogisticsMethodSiteDetail';
			t.c.id_tab_1 = 'id_tab_1_'+s;
			t.c.id_tab_2 = 'id_tab_2_' + s;
			t.c.id_tab_3 = 'id_tab_3_' + s;
			t.c.id_tab_4 = 'id_tab_4_' + s;
			t.c.id_tab_5 = 'id_tab_5_' + s;
			t.c.id_tab_6 = 'id_tab_6_' + s;
			t.c.id_grid_1 = 'id_grid_1_' + s;
			t.c.id_grid_2 = 'id_grid_2_' + s;
			t.c.id_grid_3 = 'id_grid_3_' + s;
			t.c.id_grid_4 = 'id_grid_4_' + s;
			t.c.id_grid_5 = 'id_grid_5_' + s;
			t.c.id_grid_6 = 'id_grid_6_' + s;
			t.c.data = c.data; // 数据
			t.c.data2 = c.data2; // 调货信息数组
			t.c.data3 = c.data3; // 权限信息数据
			t.c.data4 = c.data4; // 目地信息数据
			t.c.data5 = c.data5; // 运营公司数据
			t.c.data6 = c.data6; // 可发送的目地

			/**自定义的字段，是否流转中**/
			t.c.onProcess = c.onProcess;
			t.c.boutiqueId = c.boutiqueId;
			t.c.code = c.code;

			//复选框选中，存放行号，表1
			t.c.checkedIndex_1 = [];
			t.c.checkedIndex_2 = [];
			t.c.checkedIndex_3 = [];
			t.c.checkedIndex_4 = [];
			t.c.checkedIndex_5 = [];
			t.c.checkedIndex_6 = [];
		},
		load:function () { // 加载控件
			var h = ``
				+ `<div class="layui-tab layui-tab-brief" style="background-color: #fff; height:877px;" >`
				+ `<ul class="layui-tab-title">`
				+ `<li class="layui-this">1、计重梯度计费标准</li>`
				+ `<li>2、材质附加计费标准</li>`
				+ `<li>3、抛重附加计费标准</li>`
				+ `<li>4、目地地附加计费标准</li>`
				+ `<li>5、运营公司信息</li>`
				+ `<li>6、可发送的目地</li>`
				+ `</ul>`

				+ `<div class="layui-tab-content">`
				+ `<div class="layui-tab-item layui-show">`
				+ `<div class="layui-table-tool" style="padding: 0; min-height: 0; background-color: #ffffff;" id="` + this.c.id_tab_1 + `">`
				+ `<div class="layui-table-tool-temp">`;
			if (this.c.onProcess == 0) {
				h+=`<div class="layui-btn-container" style="padding-bottom: 10px;padding-left: 10px;">`
					+ `<a class="layui-btn layui-btn-normal layui-btn-sm " lay-event="event-to-select-1"><i class="iconfont icon-add-btn"></i>新增</a>`
					+ `<a class="layui-btn layui-btn-danger layui-btn-sm " lay-event="event-to-del-1" ><i class="layui-icon layui-icon-delete"></i>删除</a>`
					+ `</div>`;
			}
			h+= `<div class="layui-form layui-form-item" pane>`
				+ `<div id="` + this.c.id_grid_1 + `">`
				+ this.loadTable()
				+ `</div>`
				+ `</div>`
				+ `</div>`
				+ `</div>`
				+ `</div>`
				+ `<div class="layui-tab-item">`
				+ `<div class="layui-table-tool" style="padding: 0; min-height: 0; background-color: #ffffff;" id="` + this.c.id_tab_2 + `">`
				+ `<div class="layui-table-tool-temp" style="padding-right: 0;">`;
			if (this.c.onProcess == 0) {
				h+= `<div class="layui-btn-container" style="padding-bottom: 10px;padding-left: 10px;">`
					+ `<a class="layui-btn layui-btn-normal layui-btn-sm " lay-event="event-to-select-2"><i class="iconfont icon-add-btn"></i>新增</a>`
					+ `<a class="layui-btn layui-btn-danger layui-btn-sm " lay-event="event-to-del-2" ><i class="layui-icon layui-icon-delete"></i>删除</a>`
					+ `</div>`;
			}
			h+= `<div class="layui-form layui-form-item" pane>`
				+ `<div id="` + this.c.id_grid_2 + `">`
				+ this.loadGrid_2()
				+ `</div>`
				+ `</div>`
				+ `</div>`
				+ `</div>`
				+ `</div>`
				+ `<div class="layui-tab-item">`
				+ `<div class="layui-table-tool" style="padding: 0; min-height: 0; background-color: #ffffff;" id="` + this.c.id_tab_3 + `">`
				+ `<div class="layui-table-tool-temp">`;
			if (this.c.onProcess == 0) {
				h+=`<div class="layui-btn-container" style="padding-bottom: 10px;padding-left: 10px;">`
					+ `<a class="layui-btn layui-btn-normal layui-btn-sm " lay-event="event-to-select-3"><i class="iconfont icon-add-btn"></i>新增</a>`
					+ `<a class="layui-btn layui-btn-danger layui-btn-sm " lay-event="event-to-del-3" ><i class="layui-icon layui-icon-delete"></i>删除</a>`
					+ `</div>`;
			}
			h+= `<div class="layui-form layui-form-item" pane>`
				+ `<div id="` + this.c.id_grid_3 + `">`
				+ this.loadGrid_3()
				+ `</div>`
				+ `</div>`
					+ `</div>`
					+ `</div>`
					+ `</div>`
					+ `<div class="layui-tab-item">`
					+ `<div class="layui-table-tool" style="padding: 0; min-height: 0; background-color: #ffffff;" id="` + this.c.id_tab_4 + `">`
					+ `<div class="layui-table-tool-temp" style="padding-right: 0;">`;
				if (this.c.onProcess == 0) {
					h+= `<div class="layui-btn-container" style="padding-bottom: 10px;padding-left: 10px;">`
						+ `<a class="layui-btn layui-btn-normal layui-btn-sm " lay-event="event-to-select-4"><i class="iconfont icon-add-btn"></i>新增</a>`
						+ `<a class="layui-btn layui-btn-danger layui-btn-sm " lay-event="event-to-del-4" ><i class="layui-icon layui-icon-delete"></i>删除</a>`
						+ `</div>`;
				}
				h+= `<div class="layui-form layui-form-item" pane>`
					+ `<div id="` + this.c.id_grid_4 + `">`
					+ this.loadGrid_4()
					+ `</div>`
					+ `</div>`
				+ `</div>`
				+ `</div>`
				+ `</div>`;


			h+= `<div class="layui-tab-item">`
			+ `<div class="layui-table-tool" style="padding: 0; min-height: 0; background-color: #ffffff;" id="` + this.c.id_tab_5 + `">`
			+ `<div class="layui-table-tool-temp" style="padding-right: 0;">`;
			if (this.c.onProcess == 0) {
				h+= `<div class="layui-btn-container" style="padding-bottom: 10px;padding-left: 10px;">`
					+ `<a class="layui-btn layui-btn-normal layui-btn-sm " lay-event="event-to-select-5"><i class="iconfont icon-add-btn"></i>新增</a>`
					+ `<a class="layui-btn layui-btn-danger layui-btn-sm " lay-event="event-to-del-5" ><i class="layui-icon layui-icon-delete"></i>删除</a>`
					+ `</div>`;
			}
			h+= `<div class="layui-form layui-form-item" pane>`
				+ `<div id="` + this.c.id_grid_5 + `">`
				+ this.loadGrid_5()
				+ `</div>`
				+ `</div>`
				+ `</div>`
				+ `</div>`
				+ `</div>`

			h+= `<div class="layui-tab-item">`
				+ `<div class="layui-table-tool" style="padding: 0; min-height: 0; background-color: #ffffff;" id="` + this.c.id_tab_6 + `">`
				+ `<div class="layui-table-tool-temp" style="padding-right: 0;">`;
			if (this.c.onProcess == 0) {
				h+= `<div class="layui-btn-container" style="padding-bottom: 10px;padding-left: 10px;">`
					+ `<a class="layui-btn layui-btn-normal layui-btn-sm " lay-event="event-to-select-6"><i class="iconfont icon-add-btn"></i>新增</a>`
					+ `<a class="layui-btn layui-btn-danger layui-btn-sm " lay-event="event-to-del-6" ><i class="layui-icon layui-icon-delete"></i>删除</a>`
					+ `</div>`;
			}
			h+= `<div class="layui-form layui-form-item" pane>`
				+ `<div id="` + this.c.id_grid_6 + `">`
				+ this.loadGrid_6()
				+ `</div>`
				+ `</div>`
				+ `</div>`
				+ `</div>`
				+ `</div>`

				+ `</div>`
				+ `</div>`
				+ `</div>`;
			$('#'+this.c.id).html(h);
			this.listenAll();
		},
		loadTable:function () { // 加载表格
			return ``
				+ `<div class="layui-table-box">`
				+ `<div class="layui-table-header" style="height: 300px; max-height: 300px; overflow: auto; background-color: #ffffff;">`
				+ `<table cellspacing="0" cellpadding="0" border="0" class="layui-table" lay-skin="grid" lay-even="" style="margin: 0;">`
				+ `<thead>`
				+ this.loadTableOfThead()
				+ `</thead>`
				+ `<tbody>` + this.loadTableOfTbody()+`</tbody>`
				+ `</table>`
				+ `</div>`
				+ `</div>`;
		},
		loadTableOfThead:function () { // 加载表头
			var h = `<thead>`;
			h +=`<tr>`;
			h += `<th style="width:1.9%; text-align: center; color: #000000;padding: 0 !important;">
							<input type="checkbox" id="checkAll" lay-skin="primary" lay-filter="checkAll">
						</th>`;
			h += `<th style="width:5%; text-align: center; color: #000000;">起始重量（kg）</th>`;
			h += `<th style="width:5%; text-align: center; color: #000000;">最终重量（kg）</th>`;
			h += `<th style="width:5%; text-align: center; color: #000000;">计重费（￥/kg）</th>`;
			h += `</tr>`;
			h + `</thead>`;
			return h;
		},
		loadTableOfTbody:function () { // 加载表tbody
			var t = this;
			var h = `<tbody id="tbody">`;
			for(var i=0;i<t.c.data.length;i++){
				h += `<tr id="table_th_`+i+`">`;
				h += t.loadTableTdOfTbody(t.c.data[i],i);
				h+= `</tr>`;
			}

			h += `</tbody>`;
			return h;
		},
		loadTableTdOfTbody:function (data,i) { // 加载表格行
			var h = ``;
			h += `<td style="text-align:center;padding:0;">
					<input type="checkbox" class="chBox"  lay-skin="primary" data-index="` + i + `"  lay-filter="checkBoxOne">
					</td>`;
			h += `<td style="text-align:center; width:100px;padding: 0 !important;border-width: 1px;"><input type="text"  class="text_align_center layui-input" data-index="` + i + `" data-type="heavySn" lay-filter="_input"  value="` + (data.heavySn ||data.heavySn==0? data.heavySn : ``) + `" ></td>`;
			h += `<td style="text-align:center; width:100px;padding: 0 !important;border-width: 1px;"><input type="text"  class="text_align_center layui-input" data-index="` + i + `" data-type="heavyEn" lay-filter="_input"  value="` + (data.heavyEn ||data.heavyEn==0? data.heavyEn : ``) + `" ></td>`;
			h += `<td style="text-align:center; width:100px;padding: 0 !important;border-width: 1px;"><input type="text"  class="text_align_center layui-input" data-index="` + i + `" data-type="price" lay-filter="_input"  value="` + (data.price||data.price==0 ? data.price : ``) + `" ></td>`;


			return h;
		},
		loadGrid_2:function () { // 加载表格
			return `<table class="layui-table" lay-skin="row" style="margin:0;"><thead>`+this.loadGrid_2_OfThead()+`</thead><tbody>`+this.loadGrid_2_OfTbody()+`</tbody></table>`;
		},
		reloadGrid_2:function () { // 重新加载第二张表格
			$('#'+this.c.id_grid_2).html(this.loadGrid_2());
			this.listenGrid_2();
		},
		loadGrid_2_OfThead:function () { // 加载表头
			var h = `<thead><tr>`;
			h += `<th style="width:1.9%; text-align: center; color: #000000;padding: 0 !important;">
							<input type="checkbox" id="checkAll_2" lay-skin="primary" lay-filter="checkAll_2">
						</th>`;
			h += `<th style="width:5%; text-align: center;color: #000000;padding: 0 !important;">材质名称（中文）</th>`;
			h += `<th style="width:5%; text-align: center;color: #000000;padding: 0 !important;">材质名称（英文）</th>`;
			h += `<th style="width:5%; text-align: center;color: #000000;padding: 0 !important;">材质附加计费（￥/kg）</th>`;

			return h;
		},
		loadGrid_2_OfTbody:function () { // 加载表tbody
			var t = this;
			var h = `<tbody id="tbody_2">`;
			for(var i=0;i<t.c.data2.length;i++){
				h += `<tr id="table_2_th_`+i+`">`;
				h += t.loadTableTdOfTbody_2(t.c.data2[i],i);
				h+= `</tr>`;
			}

			h += `</tbody>`;
			return h;
		},
		loadTableTdOfTbody_2:function (data,i) { // 加载表格行
			var h = ``;
			h += `<td style="text-align:center;padding:0;">
				<input type="checkbox" class="chBox_2"  lay-skin="primary" data-index="` + i + `"  lay-filter="checkBoxOne_2">
				</td>`;

			h += `<td style="text-align:center; width:100px;padding: 0 !important;border-width: 1px;"><input readonly type="text"  class="text_align_center layui-input" data-index="` + i + `" data-type="materialNameCn" lay-filter="_input"  value="` + (data.materialNameCn ? data.materialNameCn : ``) + `" ></td>`;
			h += `<td style="text-align:center; width:100px;padding: 0 !important;border-width: 1px;"><input readonly type="text"  class="text_align_center layui-input" data-index="` + i + `" data-type="materialNameEn" lay-filter="_input"  value="` + (data.materialNameEn ? data.materialNameEn : ``) + `" ></td>`;
			h += `<td style="text-align:center; width:100px;padding: 0 !important;border-width: 1px;"><input type="text"  class="text_align_center layui-input" data-index="` + i + `" data-type="additionalMaterialBilling" lay-filter="_input"  value="` + (data.additionalMaterialBilling ? data.additionalMaterialBilling : ``) + `" ></td>`;


			return h;
		},

		loadGrid_3:function () { // 加载表格
			return `<table class="layui-table" lay-skin="row" style="margin:0;"><thead>`+this.loadGrid_3_OfThead()+`</thead><tbody>`+this.loadGrid_3_OfTbody()+`</tbody></table>`;
		},
		reloadGrid_3:function () { // 重新加载第三张表格
			$('#'+this.c.id_grid_3).html(this.loadGrid_3());
			this.listenGrid_3();
		},
		loadGrid_3_OfThead:function () { // 加载表头
			var h = `<thead><tr>`;
			h += `<th style="width:1.9%; text-align: center; color: #000000;padding: 0 !important;">
							<input type="checkbox" id="checkAll_3" lay-skin="primary" lay-filter="checkAll_3">
						</th>`;
			h += `<th style="width:5%; text-align: center;color: #000000;padding: 0 !important;">抛重启始（kg）</th>`;
			h += `<th style="width:5%; text-align: center;color: #000000;padding: 0 !important;">抛重最终（kg）</th>`;
			h += `<th style="width:5%; text-align: center;color: #000000;padding: 0 !important;">附加计费（￥/kg）</th>`;
			return h;
		},
		loadGrid_3_OfTbody:function () { // 加载表tbody
			var t = this;
			var h = `<tbody id="tbody_3">`;
			for(var i=0;i<t.c.data3.length;i++){
				h += `<tr id="table_3_th_`+i+`">`;
				h += t.loadTableTdOfTbody_3(t.c.data3[i],i);
				h+= `</tr>`;
			}

			h += `</tbody>`;
			return h;
		},
		loadTableTdOfTbody_3:function (data,i) { // 加载表格行
			var h = ``;
			h += `<td style="text-align:center;padding:0;">
					<input type="checkbox" class="chBox_3"  lay-skin="primary" data-index="` + i + `"  lay-filter="checkBoxOne_3">
					</td>`;

			h += `<td style="text-align:center; width:100px;padding: 0 !important;border-width: 1px;"><input type="text"  class="text_align_center layui-input" data-index="` + i + `" data-type="heavySn" lay-filter="_input"  value="` + (data.heavySn||data.heavySn==0 ? data.heavySn : ``) + `" ></td>`;
			h += `<td style="text-align:center; width:100px;padding: 0 !important;border-width: 1px;"><input type="text"  class="text_align_center layui-input" data-index="` + i + `" data-type="heavyEn" lay-filter="_input"  value="` + (data.heavyEn||data.heavyEn==0 ? data.heavyEn : ``) + `" ></td>`;
			h += `<td style="text-align:center; width:100px;padding: 0 !important;border-width: 1px;"><input type="text"  class="text_align_center layui-input" data-index="` + i + `" data-type="price" lay-filter="_input"  value="` + (data.price||data.price==0 ? data.price : ``) + `" ></td>`;


			return h;
		},

		loadGrid_4:function () { // 加载表格
			return `<table class="layui-table" lay-skin="row" style="margin:0;"><thead>`+this.loadGrid_4_OfThead()+`</thead><tbody>`+this.loadGrid_4_OfTbody()+`</tbody></table>`;
		},
		reloadGrid_4:function () { // 重新加载第四张表格
			$('#'+this.c.id_grid_4).html(this.loadGrid_4());
			this.listenGrid_4();
		},
		loadGrid_4_OfThead:function () { // 加载表头
			var h = `<thead><tr>`;
			h += `<th style="width:1.9%; text-align: center; color: #000000;padding: 0 !important;">
							<input type="checkbox" id="checkAll_4" lay-skin="primary" lay-filter="checkAll_4">
						</th>`;
			h += `<th style="width:5%; text-align: center;color: #000000;padding: 0 !important;">仓库区域</th>`;
			h += `<th style="width:5%; text-align: center;color: #000000;padding: 0 !important;">邮编首数字</th>`;
			h += `<th style="width:5%; text-align: center;color: #000000;padding: 0 !important;">仓库代码</th>`;
			h += `<th style="width:5%; text-align: center;color: #000000;padding: 0 !important;">附加计费（￥/kg）</th>`;
			return h;
		},
		loadGrid_4_OfTbody:function () { // 加载表tbody
			var t = this;
			var h = `<tbody id="tbody_4">`;
			for(var i=0;i<t.c.data4.length;i++){
				h += `<tr id="table_4_th_`+i+`">`;
				h += t.loadTableTdOfTbody_4(t.c.data4[i],i);
				h+= `</tr>`;
			}

			h += `</tbody>`;
			return h;
		},
		loadTableTdOfTbody_4:function (data,i) { // 加载表格行
			var h = ``;
			h += `<td style="text-align:center;padding:0;">
					<input type="checkbox" class="chBox_4"  lay-skin="primary" data-index="` + i + `"  lay-filter="checkBoxOne_4">
					</td>`;
			h += `<td style="text-align:center; width:100px;padding: 0 !important;border-width: 1px;"><input type="text"  class="text_align_center layui-input" data-index="` + i + `" data-type="warehouseArea" lay-filter="_input"  value="` + (data.warehouseArea ? data.warehouseArea : ``) + `" ></td>`;
			h += `<td style="text-align:center; width:100px;padding: 0 !important;border-width: 1px;"><input type="text"  class="text_align_center layui-input" data-index="` + i + `" data-type="firstPostalCode" lay-filter="_input"  value="` + (data.firstPostalCode ? data.firstPostalCode : ``) + `" ></td>`;
			h += `<td style="text-align:center; width:100px;padding: 0 !important;border-width: 1px;"><input type="text"  class="text_align_center layui-input" data-index="` + i + `" data-type="warehouseCode" lay-filter="_input"  value="` + (data.warehouseCode ? data.warehouseCode : ``) + `" ></td>`;
			h += `<td style="text-align:center; width:100px;padding: 0 !important;border-width: 1px;"><input type="text"  class="text_align_center layui-input" data-index="` + i + `" data-type="additionalBilling" lay-filter="_input"  value="` + (data.additionalBilling ? data.additionalBilling : ``) + `" ></td>`;


			return h;
		},

		loadGrid_5:function () { // 加载表格
			return `<table class="layui-table" lay-skin="row" style="margin:0;"><thead>`+this.loadGrid_5_OfThead()+`</thead><tbody>`+this.loadGrid_5_OfTbody()+`</tbody></table>`;
		},
		reloadGrid_5:function () { // 重新加载第5张表格
			$('#'+this.c.id_grid_5).html(this.loadGrid_5());
			this.listenGrid_5();
		},
		loadGrid_5_OfThead:function () { // 加载表头
			var h = `<thead><tr>`;
			h += `<th style="width:1.9%; text-align: center; color: #000000;padding: 0 !important;">
							<input type="checkbox" id="checkAll_5" lay-skin="primary" lay-filter="checkAll_5">
						</th>`;
			h += `<th style="width:5%; text-align: center;color: #000000;padding: 0 !important;">运营公司编码</th>`;
			h += `<th style="width:5%; text-align: center;color: #000000;padding: 0 !important;">运营公司简称</th>`;

			return h;
		},
		loadGrid_5_OfTbody:function () { // 加载表tbody
			var t = this;
			var h = `<tbody id="tbody_5">`;
			for(var i=0;i<t.c.data5.length;i++){
				h += `<tr id="table_5_th_`+i+`">`;
				h += t.loadTableTdOfTbody_5(t.c.data5[i],i);
				h+= `</tr>`;
			}

			h += `</tbody>`;
			return h;
		},
		loadTableTdOfTbody_5:function (data,i) { // 加载表格行
			var h = ``;
			h += `<td style="text-align:center;padding:0;">
				<input type="checkbox" class="chBox_5"  lay-skin="primary" data-index="` + i + `"  lay-filter="checkBoxOne_5">
				</td>`;

			h += `<td style="text-align:center; width:100px;padding: 0 !important;border-width: 1px;"><input readonly type="text"  class="text_align_center layui-input" data-index="` + i + `" data-type="vgsbm" lay-filter="_input"  value="` + (data.vgsbm ? data.vgsbm : ``) + `" ></td>`;
			h += `<td style="text-align:center; width:100px;padding: 0 !important;border-width: 1px;"><input readonly type="text"  class="text_align_center layui-input" data-index="` + i + `" data-type="vgsjc" lay-filter="_input"  value="` + (data.vgsjc ? data.vgsjc : ``) + `" ></td>`;


			return h;
		},
		loadGrid_6:function () { // 加载表格
			return `<table class="layui-table" lay-skin="row" style="margin:0;"><thead>`+this.loadGrid_6_OfThead()+`</thead><tbody>`+this.loadGrid_6_OfTbody()+`</tbody></table>`;
		},
		reloadGrid_6:function () { // 重新加载第四张表格
			$('#'+this.c.id_grid_6).html(this.loadGrid_6());
			this.listenGrid_6();
		},
		loadGrid_6_OfThead:function () { // 加载表头
			var h = `<thead><tr>`;
			h += `<th style="width:1.9%; text-align: center; color: #000000;padding: 0 !important;">
							<input type="checkbox" id="checkAll_6" lay-skin="primary" lay-filter="checkAll_6">
						</th>`;

			h += `<th style="width:5%; text-align: center;color: #000000;padding: 0 !important;">仓库代码</th>`;
			return h;
		},
		loadGrid_6_OfTbody:function () { // 加载表tbody
			var t = this;
			var h = `<tbody id="tbody_6">`;
			for(var i=0;i<t.c.data6.length;i++){
				h += `<tr id="table_6_th_`+i+`">`;
				h += t.loadTableTdOfTbody_6(t.c.data6[i],i);
				h+= `</tr>`;
			}

			h += `</tbody>`;
			return h;
		},
		loadTableTdOfTbody_6:function (data,i) { // 加载表格行
			var h = ``;
			h += `<td style="text-align:center;padding:0;">
					<input type="checkbox" class="chBox_6"  lay-skin="primary" data-index="` + i + `"  lay-filter="checkBoxOne_6">
					</td>`;

			h += `<td style="text-align:center; width:100px;padding: 0 !important;border-width: 1px;"><input type="text"  class="text_align_center layui-input" data-index="` + i + `" data-type="warehouseCode" lay-filter="_input"  value="` + (data.warehouseCode ? data.warehouseCode : ``) + `" ></td>`;


			return h;
		},

		listenAll:function () { // 添加监听
			var t = this;

			var domTable = $('#' + t.c.id_tab_1);

			// 监听标签页1
			t.listenTab_1();

			// 监听标签页2
			t.listenTab_2();

			// 监听标签页3
			t.listenTab_3();

			// 监听标签页4
			t.listenTab_4();

			// 监听标签页5
			t.listenTab_5();

			// 监听标签页6
			t.listenTab_6();

			// 表单控件重新加载
			form.render();
		},
		listenTab_1:function () { // 添加监听1
			var t = this;

			var domTab = $('#' + t.c.id_tab_1);

			// 监听“新增”按钮
			domTab.find('a[lay-event="event-to-select-1"]').on('click',function (e) {
				var rowCurrent = {};
				rowCurrent.heavySn = "";
				rowCurrent.heavyEn = "";
				rowCurrent.price = "";


				t.addRow(rowCurrent);
			});

			// 监听“删除”按钮
			$('a[lay-event="event-to-del-1"]').on('click',function (e) {
				var checkedIndexList = t.c.checkedIndex_1;
				if (checkedIndexList.length ==0 || checkedIndexList==null){
					return layer.msg("请至少选择一条要删除的数据!");
				}
				var newData = [];
				for (var i = 0; i < t.c.data.length; i++) {
					var isDel = false;
					for (var j = 0; j < checkedIndexList.length; j++) {
						if(i == checkedIndexList[j]){
							isDel = true;
						}
					}
					if(!isDel){
						newData.push(t.c.data[i]);
					}
				}
				t.c.data = newData;
				$('#' + t.c.id).empty();
				return t.reload(t.c);

			}),

			//全选
			layui.form.on('checkbox(checkAll)', function(data){
				var elem = data.elem;
				$(".chBox").prop("checked", elem.checked);
				var checkedIndex = [];
				$(".chBox").each(function(k, v){
					if ($(v).is(':checked')) {
						checkedIndex.push($(v).attr('data-index'));
					}
				});
				t.c.checkedIndex_1 = checkedIndex;
				//console.log('t.c.checkedIndex',t.c.checkedIndex_1);
				layui.form.render();
			});
			// 列表里的小选择框点击
			layui.form.on('checkbox(checkBoxOne)', function(data){
				var elem = data.elem;
				//console.log('elem',elem);
				if ($(".chBox").not('input:checked').length) {
					$('#checkAll').prop("checked", false);
				} else {
					$('#checkAll').prop("checked", true);
				}
				var checkedIndex = [];
				$(".chBox").each(function(k, v){
					if ($(v).is(':checked')) {
						checkedIndex.push($(v).attr('data-index'));
					}
				});
				t.c.checkedIndex_1 = checkedIndex;
				//console.log('t.c.checkedIndex',t.c.checkedIndex_1);
				layui.form.render();
			});

			t.listenGrid_1();
		},
		listenTab_2:function () { // 添加监听2
			var t = this;

			var domTab = $('#' + t.c.id_tab_2);

			// 监听“新增”按钮
			domTab.find('a[lay-event="event-to-select-2"]').on('click',function (e) {
				var selectedDatas = [];
				//回填数据的代码
				var gridDatas = t.c.data2;
				for (var i = 0; i < gridDatas.length; i++) {
					var row = {};
					row.materialCn = gridDatas[i].materialNameCn;
					row.materialEn= gridDatas[i].materialNameEn;
					row.additionalMaterialBilling = gridDatas[i].additionalMaterialBilling;

					selectedDatas.push(row);
				}
				layui.YsModal.init({
					modalKey: 'TB_BaseinfoSpcz',
					type: 'checkbox',
					uniqueKey: 'materialCn',
					parentObj: t,
					extraData:'materialCn',
					selectedData: selectedDatas
				})
			});
			// 监听“删除”按钮
			$('a[lay-event="event-to-del-2"]').on('click',function (e) {
				var checkedIndexList = t.c.checkedIndex_2;
				if (checkedIndexList.length ==0 || checkedIndexList==null){
					return layer.msg("请至少选择一条要删除的数据!");
				}
				var newData = [];
				for (var i = 0; i < t.c.data2.length; i++) {
					var isDel = false;
					for (var j = 0; j < checkedIndexList.length; j++) {
						if(i == checkedIndexList[j]){
							isDel = true;
						}
					}
					if(!isDel){
						newData.push(t.c.data2[i]);
					}
				}
				t.c.data2 = newData;
				$('#' + t.c.id).empty();
				return t.reload(t.c);
			}),

				//全选
				layui.form.on('checkbox(checkAll_2)', function(data){
					var elem = data.elem;
					$(".chBox_2").prop("checked", elem.checked);
					var checkedIndex = [];
					$(".chBox_2").each(function(k, v){
						if ($(v).is(':checked')) {
							checkedIndex.push($(v).attr('data-index'));
						}
					});
					t.c.checkedIndex_2 = checkedIndex;
					//console.log('t.c.checkedIndex',t.c.checkedIndex_1);
					layui.form.render();
				});

			// 列表里的小选择框点击
			layui.form.on('checkbox(checkBoxOne_2)', function(data){
				var elem = data.elem;
				//console.log('elem',elem);
				if ($(".chBox_2").not('input:checked').length) {
					$('#checkAll_2').prop("checked", false);
				} else {
					$('#checkAll_2').prop("checked", true);
				}
				var checkedIndex = [];
				$(".chBox_2").each(function(k, v){
					if ($(v).is(':checked')) {
						checkedIndex.push($(v).attr('data-index'));
					}
				});
				t.c.checkedIndex_2 = checkedIndex;
				//console.log('t.c.checkedIndex',t.c.checkedIndex_1);
				layui.form.render();
			});

			t.listenGrid_2();
		},
		listenTab_3:function () { // 添加监听3
			var t = this;
			layui.form.on('select(_input_filter_selector_on_form)', function (data) {
				var value = data.value;
				var name = data.elem[0].innerText;
				//判断是自税处理清空
				if(name=="自税"){
					t.c.data3 = [];
					$('#' + t.c.id).empty();
					return t.reload(t.c);
				}
			});
			var domTab = $('#' + t.c.id_tab_3);

			// 监听“新增”按钮
			domTab.find('a[lay-event="event-to-select-3"]').on('click',function (e) {
				if ($('#nameLogsticsClearance').val()==0){
					return layer.msg("自税不能新增抛重附加计费标准");
				}
				var rowCurrent = {};
				rowCurrent.heavySn = "";
				rowCurrent.heavyEn = "";
				rowCurrent.price = "";


				t.addRow3(rowCurrent);
			});
			// 监听“删除”按钮
			$('a[lay-event="event-to-del-3"]').on('click',function (e) {
				var checkedIndexList = t.c.checkedIndex_3;
				if (checkedIndexList.length ==0 || checkedIndexList==null){
					return layer.msg("请至少选择一条要删除的数据!");
				}
				var newData = [];
				for (var i = 0; i < t.c.data3.length; i++) {
					var isDel = false;
					for (var j = 0; j < checkedIndexList.length; j++) {
						if(i == checkedIndexList[j]){
							isDel = true;
						}
					}
					if(!isDel){
						newData.push(t.c.data3[i]);
					}
				}
				t.c.data3 = newData;
				$('#' + t.c.id).empty();
				return t.reload(t.c);
			}),

				//全选
				layui.form.on('checkbox(checkAll_3)', function(data){
					var elem = data.elem;
					$(".chBox_3").prop("checked", elem.checked);
					var checkedIndex = [];
					$(".chBox_3").each(function(k, v){
						if ($(v).is(':checked')) {
							checkedIndex.push($(v).attr('data-index'));
						}
					});
					t.c.checkedIndex_3 = checkedIndex;
					//console.log('t.c.checkedIndex',t.c.checkedIndex_1);
					layui.form.render();
				});

			// 列表里的小选择框点击
			layui.form.on('checkbox(checkBoxOne_3)', function(data){
				var elem = data.elem;
				//console.log('elem',elem);
				if ($(".chBox_3").not('input:checked').length) {
					$('#checkAll_3').prop("checked", false);
				} else {
					$('#checkAll_3').prop("checked", true);
				}
				var checkedIndex = [];
				$(".chBox_3").each(function(k, v){
					if ($(v).is(':checked')) {
						checkedIndex.push($(v).attr('data-index'));
					}
				});
				t.c.checkedIndex_3 = checkedIndex;
				//console.log('t.c.checkedIndex',t.c.checkedIndex_1);
				layui.form.render();
			});

			t.listenGrid_3();
		},

		listenTab_4:function () { // 添加监听4
			var t = this;

			var domTab = $('#' + t.c.id_tab_4);

			// 监听“新增”按钮
			domTab.find('a[lay-event="event-to-select-4"]').on('click',function (e) {
				var rowCurrent = {};
				rowCurrent.warehouseArea = "";
				rowCurrent.firstPostalCode = "";
				rowCurrent.warehouseCode = "";
				rowCurrent.additionalBilling = "";


				t.addRow4(rowCurrent);
			});
			// 监听“删除”按钮
			$('a[lay-event="event-to-del-4"]').on('click',function (e) {
				var checkedIndexList = t.c.checkedIndex_4;
				if (checkedIndexList.length ==0 || checkedIndexList==null){
					return layer.msg("请至少选择一条要删除的数据!");
				}
				var newData = [];
				for (var i = 0; i < t.c.data4.length; i++) {
					var isDel = false;
					for (var j = 0; j < checkedIndexList.length; j++) {
						if(i == checkedIndexList[j]){
							isDel = true;
						}
					}
					if(!isDel){
						newData.push(t.c.data4[i]);
					}
				}
				t.c.data4 = newData;
				$('#' + t.c.id).empty();
				return t.reload(t.c);
			}),

				//全选
				layui.form.on('checkbox(checkAll_4)', function(data){
					var elem = data.elem;
					$(".chBox_4").prop("checked", elem.checked);
					var checkedIndex = [];
					$(".chBox_4").each(function(k, v){
						if ($(v).is(':checked')) {
							checkedIndex.push($(v).attr('data-index'));
						}
					});
					t.c.checkedIndex_4 = checkedIndex;
					//console.log('t.c.checkedIndex',t.c.checkedIndex_1);
					layui.form.render();
				});

			// 列表里的小选择框点击
			layui.form.on('checkbox(checkBoxOne_4)', function(data){
				var elem = data.elem;
				//console.log('elem',elem);
				if ($(".chBox_4").not('input:checked').length) {
					$('#checkAll_4').prop("checked", false);
				} else {
					$('#checkAll_4').prop("checked", true);
				}
				var checkedIndex = [];
				$(".chBox_4").each(function(k, v){
					if ($(v).is(':checked')) {
						checkedIndex.push($(v).attr('data-index'));
					}
				});
				t.c.checkedIndex_4 = checkedIndex;
				//console.log('t.c.checkedIndex',t.c.checkedIndex_1);
				layui.form.render();
			});

			t.listenGrid_4();
		},

		listenTab_5:function () { // 添加监听5
			var t = this;

			var domTab = $('#' + t.c.id_tab_5);

			// 监听“新增”按钮
			domTab.find('a[lay-event="event-to-select-5"]').on('click',function (e) {
				layui.YsModal.init({
					modalKey: 'THR_OperateCompanyApplyLogistics',
					type: 'checkbox',
					uniqueKey: 'vgsbm',
					parentObj: t,
					extraData:'vgsbm',
					selectedData: []
				})
				// var selectedDatas = [];
				// //回填数据的代码
				// var gridDatas = t.c.data5;
				// for (var i = 0; i < gridDatas.length; i++) {
				// 	var row = {};
				// 	row.vgsbm = gridDatas[i].vgsbm;
				//
				// 	selectedDatas.push(row);
				// }
				// layui.YsModal.init({
				// 	modalKey: 'THR_OperateCompanyApplyLogistics',
				// 	type: 'checkbox',
				// 	uniqueKey: 'vgsbm',
				// 	parentObj: t,
				// 	extraData:'vgsbm',
				// 	selectedData: selectedDatas
				// })

			});
			// 监听“删除”按钮
			$('a[lay-event="event-to-del-5"]').on('click',function (e) {
				var checkedIndexList = t.c.checkedIndex_5;
				if (checkedIndexList.length ==0 || checkedIndexList==null){
					return layer.msg("请至少选择一条要删除的数据!");
				}
				var newData = [];
				for (var i = 0; i < t.c.data5.length; i++) {
					var isDel = false;
					for (var j = 0; j < checkedIndexList.length; j++) {
						if(i == checkedIndexList[j]){
							isDel = true;
						}
					}
					if(!isDel){
						newData.push(t.c.data5[i]);
					}
				}
				t.c.data5 = newData;
				$('#' + t.c.id).empty();
				return t.reload(t.c);
			}),

				//全选
				layui.form.on('checkbox(checkAll_5)', function(data){
					var elem = data.elem;
					$(".chBox_5").prop("checked", elem.checked);
					var checkedIndex = [];
					$(".chBox_5").each(function(k, v){
						if ($(v).is(':checked')) {
							checkedIndex.push($(v).attr('data-index'));
						}
					});
					t.c.checkedIndex_5 = checkedIndex;
					//console.log('t.c.checkedIndex',t.c.checkedIndex_1);
					layui.form.render();
				});

			// 列表里的小选择框点击
			layui.form.on('checkbox(checkBoxOne_5)', function(data){
				var elem = data.elem;
				//console.log('elem',elem);
				if ($(".chBox_5").not('input:checked').length) {
					$('#checkAll_5').prop("checked", false);
				} else {
					$('#checkAll_5').prop("checked", true);
				}
				var checkedIndex = [];
				$(".chBox_5").each(function(k, v){
					if ($(v).is(':checked')) {
						checkedIndex.push($(v).attr('data-index'));
					}
				});
				t.c.checkedIndex_5 = checkedIndex;
				//console.log('t.c.checkedIndex',t.c.checkedIndex_1);
				layui.form.render();
			});

			t.listenGrid_5();
		},

		listenTab_6:function () { // 添加监听6
			var t = this;

			var domTab = $('#' + t.c.id_tab_6);

			// 监听“新增”按钮
			domTab.find('a[lay-event="event-to-select-6"]').on('click',function (e) {
				var rowCurrent = {};
				rowCurrent.warehouseCode = "";

				t.addRow6(rowCurrent);
			});
			// 监听“删除”按钮
			$('a[lay-event="event-to-del-6"]').on('click',function (e) {
				var checkedIndexList = t.c.checkedIndex_6;
				if (checkedIndexList.length ==0 || checkedIndexList==null){
					return layer.msg("请至少选择一条要删除的数据!");
				}
				var newData = [];
				for (var i = 0; i < t.c.data6.length; i++) {
					var isDel = false;
					for (var j = 0; j < checkedIndexList.length; j++) {
						if(i == checkedIndexList[j]){
							isDel = true;
						}
					}
					if(!isDel){
						newData.push(t.c.data6[i]);
					}
				}
				t.c.data6 = newData;
				$('#' + t.c.id).empty();
				return t.reload(t.c);
			}),

				//全选
				layui.form.on('checkbox(checkAll_6)', function(data){
					var elem = data.elem;
					$(".chBox_6").prop("checked", elem.checked);
					var checkedIndex = [];
					$(".chBox_6").each(function(k, v){
						if ($(v).is(':checked')) {
							checkedIndex.push($(v).attr('data-index'));
						}
					});
					t.c.checkedIndex_6 = checkedIndex;
					//console.log('t.c.checkedIndex',t.c.checkedIndex_1);
					layui.form.render();
				});

			// 列表里的小选择框点击
			layui.form.on('checkbox(checkBoxOne_6)', function(data){
				var elem = data.elem;
				//console.log('elem',elem);
				if ($(".chBox_6").not('input:checked').length) {
					$('#checkAll_6').prop("checked", false);
				} else {
					$('#checkAll_6').prop("checked", true);
				}
				var checkedIndex = [];
				$(".chBox_6").each(function(k, v){
					if ($(v).is(':checked')) {
						checkedIndex.push($(v).attr('data-index'));
					}
				});
				t.c.checkedIndex_6 = checkedIndex;
				//console.log('t.c.checkedIndex',t.c.checkedIndex_1);
				layui.form.render();
			});

			t.listenGrid_6();
		},


		listenGrid_1:function () { // 添加表格监听1
			var t = this;

			var domGrid = $('#' + t.c.id_grid_1);

			// 监听各个输入框
			domGrid.find('input[lay-filter="_input"]').on('change',function (e) {
				var index = $(this).attr('data-index');
				var key = $(this).attr('data-type');
				var value = $(this).val();
				t.c.data[index][key] = value;
				return;
			});

			// 监听表格中的按钮
			domGrid.find('button[lay-filter="editSingle"]').on('click',function (e) {
				var indexOfRow = $(this).attr('data-index');
				t.toEdit(t.c.data[indexOfRow].id,t.c.data[indexOfRow].countryName);
				return;
			});
			domGrid.find('button[lay-filter="detailSingle"]').on('click',function (e) {
				var indexOfRow = $(this).attr('data-index');
				t.toDetail(t.c.data[indexOfRow].id,t.c.data[indexOfRow].countryName);
				return;
			});

			domGrid.find('button[lay-filter="removeSingle"]').on('click',function (e) {
				var indexOfRow = $(this).attr('data-index');
				t.toDel(t.c.data[indexOfRow].id);
				return;
			});
			// 表单控件重新加载
			form.render();
		},
		listenGrid_2:function () { // 添加表格监听2
			var t = this;

			var domGrid = $('#' + t.c.id_grid_2);

			// 监听各个输入框
			domGrid.find('input[lay-filter="_input"]').on('change',function (e) {
				var index = $(this).attr('data-index');
				var key = $(this).attr('data-type');
				var value = $(this).val();
				t.c.data2[index][key] = value;
				return;
			});

			// 表单控件重新加载
			form.render();
		},
		listenGrid_3:function () { // 添加表格监听3
			var t = this;

			var domGrid = $('#' + t.c.id_grid_3);
			// 监听各个输入框
			domGrid.find('input[lay-filter="_input"]').on('change',function (e) {
				var index = $(this).attr('data-index');
				var key = $(this).attr('data-type');
				var value = $(this).val();
				t.c.data3[index][key] = value;
				return;
			});

			// 表单控件重新加载
			form.render();
		},
		listenGrid_4:function () { // 添加表格监听4
			var t = this;

			var domGrid = $('#' + t.c.id_grid_4);
			// 监听各个输入框
			domGrid.find('input[lay-filter="_input"]').on('change',function (e) {
				var index = $(this).attr('data-index');
				var key = $(this).attr('data-type');
				var value = $(this).val();
				t.c.data4[index][key] = value;
				return;
			});
			// 表单控件重新加载
			form.render();
		},
		listenGrid_5:function () { // 添加表格监听5
			var t = this;

			var domGrid = $('#' + t.c.id_grid_5);

			// 监听各个输入框
			domGrid.find('input[lay-filter="_input"]').on('change',function (e) {
				var index = $(this).attr('data-index');
				var key = $(this).attr('data-type');
				var value = $(this).val();
				t.c.data5[index][key] = value;
				return;
			});

			// 表单控件重新加载
			form.render();
		},
		listenGrid_6:function () { // 添加表格监听6
			var t = this;

			var domGrid = $('#' + t.c.id_grid_6);
			// 监听各个输入框
			domGrid.find('input[lay-filter="_input"]').on('change',function (e) {
				var index = $(this).attr('data-index');
				var key = $(this).attr('data-type');
				var value = $(this).val();
				t.c.data6[index][key] = value;
				return;
			});
			// 表单控件重新加载
			form.render();
		},
		toEdit:function(siteId,countryName) {
			var t = this;
			var code = t.c.code;
			var w=($(window).width());
			var h=($(window).height());
			layer.open({
				title:"编辑("+code+"-"+countryName+"-"+siteId+")",
				type: 2,
				area: [w+'px', h +'px'],
				fix: true,
				maxmin: false,
				shadeClose: true,
				shade:0.4,
				content:"/web/storage/tccLogisticsMethod/toEdit?id="+siteId});

			return;
			//t.openUrl("精品库站点详情信息-编辑("+code+"-"+countryName+"-"+siteId+")","/web/business/tpBoutiqueSiteDetail/toEdit?id="+siteId,1);
		},
		isFrom1_0: function() {
			if(window.top.isMobile!=undefined || window.top.isMobile!=null) {
				return false;
			} else {
				return true;
			}
		},
		openUrl: function(title, url, toType) { // toType，打开页面方式，1标签页2新页面
			var isOn1_0 = this.isFrom1_0();
			if (isOn1_0 == true) {
				window.open(url);
			} else {
				if (toType != null && toType != undefined) {
					if (toType == 1) {
						window.top.add_tab(title,url);
					} else {
						window.open(url);
					}
				}
			}
		},
		toDetail:function(siteId,countryName) {
			var t = this;
			var code = t.c.code;
			var w=($(window).width());
			var h=($(window).height());
			layer.open({
				title:"精品库站点详情信息-详情("+code+"-"+countryName+"-"+siteId+")",
				type: 2,
				area: [w+'px', h +'px'],
				fix: true,
				maxmin: false,
				shadeClose: true,
				shade:0.4,
				content:"/web/business/tpBoutiqueSiteDetail/toDetail?id="+siteId});

			return;
			//t.openUrl("精品库站点详情信息-详情("+code+"-"+countryName+"-"+siteId+")","/web/business/tpBoutiqueSiteDetail/toDetail?id="+siteId,1);
		},

		//确定删除
		delYes:function(spId,checkedIndexList,delType){
			var t = this;
			var c = this.c;
			var loadIndex = layer.load(2);
			var urlStr = '';
			if(delType==1){
				urlStr = 'del';
			}else if(delType==2){
				urlStr = 'del2';
			}else{
				urlStr = 'del3';
			}
			$.ajax({
				url: '/api/inter/tccLogisticsMethod/'+urlStr,
				data: "list="+spId,
				type: 'POST',
				async: true,
				success: function (result) {
					if(result.code==0){
						layer.close(loadIndex);
						layer.msg("操作成功", {icon: 1});
						var newData = [];
						var oldData = [];
						if(delType==1){
							oldData = c.data;
						}else if(delType==2){
							oldData = c.data2;
						}else{
							oldData = c.data3;
						}
						for (var i = 0; i < oldData.length; i++) {
							var isDel = false;
							for (var j = 0; j < spId.length; j++) {
								if(oldData[i].id==spId[j]){
									isDel = true;
								}
							}
							if(!isDel){
								newData.push(oldData[i]);
							}
						}
						if(delType==1){
							c.data = newData;
						}else if(delType==2){
							c.data2 = newData;
						}else{
							c.data3 = newData;
						}
						$('#' + c.id).empty();
						return t.reload(c);
					}else {//失败
						layer.close(loadIndex);
						layer.msg(result.msg, {icon: 2});
					}
				},
				error: function () {
					layer.close(loadIndex);
					layer.msg("删除失败，请稍后再试！", {icon: 2});
				}
			});
		},


		//确定删除
		delYes_3:function(spId,checkedIndexList){
			var ids = JSON.stringify(spId);
			var t = this;
			var c = this.c;
			var loadIndex = layer.load(2);
			$.ajax({
				url: '/api/inter/tpBoutique/delByAuth',
				data: {
					'ids':ids
				},
				type: 'POST',
				async: true,
				success: function (result) {
					if(result.code==0){
						layer.close(loadIndex);
						layer.msg("操作成功", {icon: 1});
						//表格重载
						//layui.table.reload('detail_table', { });
						var newData = [];
						for (var i = 0; i < c.data3.length; i++) {
							var isDel = false;
							for (var j = 0; j < spId.length; j++) {
								if(c.data3[i].id==spId[j]){
									isDel = true;
								}
							}
							if(!isDel){
								newData.push(c.data3[i]);
							}
						}
						c.data3 = newData;
						$('#' + c.id).empty();
						return t.reload(c);

					}else {//失败
						layer.close(loadIndex);
						layer.msg(result.msg, {icon: 2});
					}
				},
				error: function () {
					layer.close(loadIndex);
					layer.msg("删除失败，请稍后再试！", {icon: 2});
				}
			});
		},

		removeRow:function(index) { // 重新加载表格
			var t = this;
			t.c.data.splice(index, 1);
			return t.reload(t.c);
		},
		getData:function () {
			return {'itemList':this.c.data, 'itemList2':this.c.data2 ,'itemList3':this.c.data3, 'itemList4':this.c.data4, 'itemList5':this.c.data5, 'itemList6':this.c.data6};
		},
		init:function (c) {this.f(c);this.load();return object;},
		reload:function (c) {c.data = this.c.data;$('#' + this.c.id).empty();return this.init(c);},
		addRow:function (row) {
			var c = this.c;
			var t = this;
			c.data.push(row);
			var h =  `<tr id="table_th_`+(c.data.length-1)+`">`;
			h += t.loadTableTdOfTbody(row,c.data.length-1);
			h+= `</tr>`;
			$('#tbody').append(h);
			t.listenGrid_1();
		},
		addRow2:function (row) {
			var c = this.c;
			var t = this;
			c.data2.push(row);
			var h = `<tr id="table_2_th_`+(c.data2.length-1)+`">`
				+ t.loadTableTdOfTbody_2(row,c.data2.length-1)
				+ `</tr>`;
			$('#tbody_2').append(h);
			t.listenGrid_2();
		},
		addRow3:function (row) {
			var c = this.c;
			var t = this;
			c.data3.push(row);
			var h = `<tr id="table_3_th_`+(c.data3.length-1)+`">`
				+ t.loadTableTdOfTbody_3(row,c.data3.length-1)
				+ `</tr>`;
			$('#tbody_3').append(h);
			t.listenGrid_3();
		},
		addRow4:function (row) {
			var c = this.c;
			var t = this;
			c.data4.push(row);
			var h = `<tr id="table_4_th_`+(c.data4.length-1)+`">`
				+ t.loadTableTdOfTbody_4(row,c.data4.length-1)
				+ `</tr>`;
			$('#tbody_4').append(h);
			t.listenGrid_4();
		},
		addRow5:function (row) {
			var c = this.c;
			var t = this;
			c.data5.push(row);
			var h = `<tr id="table_5_th_`+(c.data5.length-1)+`">`
				+ t.loadTableTdOfTbody_5(row,c.data5.length-1)
				+ `</tr>`;
			$('#tbody_5').append(h);
			t.listenGrid_5();
		},
		addRow6:function (row) {
			var c = this.c;
			var t = this;
			c.data6.push(row);
			var h = `<tr id="table_6_th_`+(c.data6.length-1)+`">`
				+ t.loadTableTdOfTbody_6(row,c.data6.length-1)
				+ `</tr>`;
			$('#tbody_6').append(h);
			t.listenGrid_6();
		},
		addRows:function (rows) {
			var c = this.c;
			for (var i = 0; i < rows.length; i++) {
				c.data.push(rows[i]);
			}
			$('#' + c.id).empty();
			return this.reload(c);
		},
		addRows2:function (rows) {
			var c = this.c;
			var t = this;
			for (var i = 0; i < rows.length; i++) {
				var row = rows[i];
				c.data2.push(row);
				var h = `<tr id="table_2_th_`+(c.data2.length-1)+`">`
					+ t.loadTableTdOfTbody_2(row,c.data2.length-1)
					+ `</tr>`;
				$('#tbody_2').append(h);
			}
			t.listenGrid_2();
		},
		addRows3:function (rows) {
			var c = this.c;
			var t = this;
			for (var i = 0; i < rows.length; i++) {
				var row = rows[i];
				c.data3.push(row);
				var h = `<tr id="table_3_th_`+(c.data3.length-1)+`">`
					+ t.loadTableTdOfTbody_3(row,c.data3.length-1)
					+ `</tr>`;
				$('#tbody_3').append(h);
			}
			t.listenGrid_3();
		},
		addRows5:function (rows) {
			var c = this.c;
			var t = this;
			for (var i = 0; i < rows.length; i++) {
				var row = rows[i];
				c.data5.push(row);
				var h = `<tr id="table_5_th_`+(c.data5.length-1)+`">`
					+ t.loadTableTdOfTbody_5(row,c.data5.length-1)
					+ `</tr>`;
				$('#tbody_5').append(h);
			}
			t.listenGrid_5();
		},
		editRow:function (index, row) {
			var c = this.c;
			c.data[index] = row;
			$('#' + c.id).empty();
			return this.reload(c);
		},
		editRowOfAttr:function (index, row) {
			var c = this.c;
			for(var key in row){
				c.data[index][key] = row[key]
			}
			$('#' + c.id).empty();
			return this.reload(c);
		},
		reloadRows:function (rows) {
			var c = this.c;
			c.data = rows;
			return this.reload(c);
		},
		//返回
		matchValuesAfterModalSelectRadio:function(colCode, data, extraData) {
			console.log('选择的',data);
			var t = this;

			// 添加站点详情
			if(extraData.useIn == 'addSite') {
				$.ajax({
					url: '/api/inter/tpBoutiqueSiteDetail/toAddOnlySite',
					data: {
						'siteId':data.id,
						'boutiqueId': t.c.boutiqueId
					},
					type: 'POST',
					async: false,
					success: function (result) {
						console.log('result:',result);
						if (result.code == 0) {
							t.addRow(result.data.tpBoutiqueSiteDetail);
						}else {//失败
							layer.msg('不好意思，系统出现问题了，请稍后重试！', {icon: 2});
						}
					},
					error: function () {
						layer.msg('不好意思，系统出现问题了，请稍后重试！', {icon: 2});
					}
				});
			}

			// 添加商品
			else if(extraData.useIn == 'addGoods') {
				var row = {};
				row['code'] = data.code;
				row['period'] = 0;
				row['numAll'] = 0;
				row['numPreBuy'] = 0;
				t.addRow2(row);
			}
			// 选择箱规
			else if(extraData.useIn == 'changeGauge') {
				var rowIndex = extraData.rowIndex;
				t.c.data2[rowIndex]['size'] = data.length + '*' + data.width + '*' + data.height;
				t.c.data2[rowIndex]['weight'] = data.weight;
				t.c.data2[rowIndex]['numPerBox'] = data.num;
				t.reloadGrid_2();
			}
			// 选择仓库
			else if(extraData.useIn == 'changeWarehouse') {
				var rowIndex = extraData.rowIndex;
				t.c.data2[rowIndex]['warehouse'] = data.depotName;
				t.reloadGrid_2();
			}
			// 添加商品
			else if(extraData.useIn == 'addAuth') {
				var row = {};
				row['boutiqueCode'] = t.c.code;
				row['vgsbm'] = data.vgsbm;
				row['vgsjc'] = data.vgsjc;
				t.addRow3(row);
			}
		},
		//多选框
		matchValuesAfterModalSelectCheckbox:function (rowsSelected, extraData) {
			var t = this;
			var rowCurrents = [];
			for (var i = 0; i < rowsSelected.length; i++) {
				var obj = rowsSelected[i];
				var isAdd = false;
				if(extraData=='materialCn'){
					for(var j = 0; j < t.c.data2.length; j++){
						if(t.c.data2[j].materialNameCn == obj.materialCn){
							isAdd = true;
						}
					}
					if(!isAdd){
						var rowCurrent = obj;
						rowCurrent.id = null;
						rowCurrent.materialNameCn = obj.materialCn;
						rowCurrent.materialNameEn = obj.materialEn;
						rowCurrents.push(rowCurrent);
					}
				}else {
					for(var j = 0; j < t.c.data5.length; j++){
						if(t.c.data5[j].vgsbm == obj.vgsbm){
							isAdd = true;
						}
					}
					if(!isAdd){
						var rowCurrent = obj;
						rowCurrent.id = null;
						rowCurrent.vgsbm= obj.vgsbm;
						rowCurrent.vgsjc= obj.vgsjc
						rowCurrents.push(rowCurrent);
					}
				}
			}
			if(extraData=='materialCn'){
				t.addRows2(rowCurrents);
			}else {
				t.addRows5(rowCurrents);
			}
		}
	};
	exports('simple_table_TCC_LogisticsMethodSiteDetail', object);
});